package Interface.Hoteleria;

import Interface.CajaPrincipal.Apertura_Caja;
import Interface.CajaPrincipal.Vista_Caja;
import Interface.GUIM;
import Interface.Renderers.Pintar_Celdas;
import Interface.Vista_Visitante;
import LN.Alquileres.Hospedaje_Salon;
import LN.Alquileres.Reserva_Salon;
import LN.Alquileres.Salon;
import LN.Alquileres.Tarifa_Salon;
import LN.Persona.Visitante.Visitante;
import LN.Varios.Caja;
import LN.Varios.Hosteria;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import net.sf.jasperreports.view.JasperViewer;

public class Salon_de_Eventos extends javax.swing.JPanel {
    
    public static Hosteria unaHosteria;
    private Visitante huesped_resrva;
    private Visitante huesped_alquiler;
    private Reserva_Salon seleccionada;
    private Hospedaje_Salon elHospedaje_Salon;
    
    public Salon_de_Eventos(Hosteria unaHosteria) {
        Salon_de_Eventos.unaHosteria = unaHosteria;
        initComponents();
        iniciarInterface();
        
    }
    
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jTextField1 = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        pnl_tbl_reservas = new javax.swing.JPanel();
        jXTaskPane1 = new org.jdesktop.swingx.JXTaskPane();
        jLabel1 = new javax.swing.JLabel();
        txt_visitante = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        dp_desde = new org.jdesktop.swingx.JXDatePicker();
        jLabel2 = new javax.swing.JLabel();
        dp_hasta = new org.jdesktop.swingx.JXDatePicker();
        cbx_tipo_reserva = new javax.swing.JComboBox();
        jLabel4 = new javax.swing.JLabel();
        btn_modificarReserva = new javax.swing.JButton();
        jLabel11 = new javax.swing.JLabel();
        txt_dni = new javax.swing.JTextField();
        panelRect3 = new org.edisoncor.gui.panel.PanelRect();
        btn_Realizar_Reserva = new javax.swing.JButton();
        btn_Lista_Reservas = new javax.swing.JButton();
        btn_Eliminar = new javax.swing.JButton();
        btn_Alquilar_Salon = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        btn_checkOUT_Salon = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        tbl_reservasSalon = new javax.swing.JTable();
        jXTaskPane2 = new org.jdesktop.swingx.JXTaskPane();
        jPanel3 = new javax.swing.JPanel();
        dp_diaIN = new org.jdesktop.swingx.JXDatePicker();
        dp_diaOUT = new org.jdesktop.swingx.JXDatePicker();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        txt_Precio_Unitario = new javax.swing.JTextField();
        txt_Descuento = new javax.swing.JTextField();
        txt_Total = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        cbx_tipo_alquiler = new javax.swing.JComboBox();
        jLabel10 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        txt_representante = new javax.swing.JTextField();
        btn_capturar = new javax.swing.JButton();
        buttonCircle3 = new org.edisoncor.gui.button.ButtonCircle();
        jScrollPane3 = new javax.swing.JScrollPane();
        tbl_alquileresSalon = new javax.swing.JTable();

        setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.LINE_AXIS));

        jTextField1.setEditable(false);
        jTextField1.setBackground(new java.awt.Color(153, 153, 153));
        jTextField1.setFont(new java.awt.Font("Copperplate Gothic Light", 1, 18)); // NOI18N
        jTextField1.setForeground(new java.awt.Color(255, 255, 255));
        jTextField1.setText("Salón de Eventos");
        jTextField1.setFocusable(false);
        jTextField1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField1ActionPerformed(evt);
            }
        });

        jScrollPane1.setBorder(javax.swing.BorderFactory.createTitledBorder("Reservas Actuales"));

        pnl_tbl_reservas.setMaximumSize(new java.awt.Dimension(600, 70));
        pnl_tbl_reservas.setPreferredSize(new java.awt.Dimension(1200, 70));
        pnl_tbl_reservas.setLayout(new javax.swing.BoxLayout(pnl_tbl_reservas, javax.swing.BoxLayout.LINE_AXIS));
        jScrollPane1.setViewportView(pnl_tbl_reservas);

        jXTaskPane1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/Reservas.png"))); // NOI18N
        jXTaskPane1.setScrollOnExpand(true);
        jXTaskPane1.setTitle("Datos para una nueva Reserva");
        jXTaskPane1.setAutoscrolls(true);

        jLabel1.setText("A nombre de:");

        txt_visitante.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                txt_visitanteMouseClicked(evt);
            }
        });
        txt_visitante.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txt_visitanteKeyTyped(evt);
            }
        });

        jLabel3.setText("Desde:");

        jLabel2.setText("Hasta:");

        dp_hasta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                dp_hastaActionPerformed(evt);
            }
        });

        jLabel4.setText("Tipo:");

        btn_modificarReserva.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/Guardar_2.png"))); // NOI18N
        btn_modificarReserva.setText("<html><p>Guardar</p><p>Cambios</p></html>");
        btn_modificarReserva.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_modificarReservaActionPerformed(evt);
            }
        });

        jLabel11.setText("DNI:");

        txt_dni.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txt_dniKeyTyped(evt);
            }
        });

        javax.swing.GroupLayout jXTaskPane1Layout = new javax.swing.GroupLayout(jXTaskPane1.getContentPane());
        jXTaskPane1.getContentPane().setLayout(jXTaskPane1Layout);
        jXTaskPane1Layout.setHorizontalGroup(
            jXTaskPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXTaskPane1Layout.createSequentialGroup()
                .addGroup(jXTaskPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jXTaskPane1Layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addGap(14, 14, 14))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jXTaskPane1Layout.createSequentialGroup()
                        .addComponent(jLabel11)
                        .addGap(18, 18, 18)))
                .addGroup(jXTaskPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(jXTaskPane1Layout.createSequentialGroup()
                        .addComponent(txt_dni)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(dp_desde, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(29, 29, 29)
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(dp_hasta, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jXTaskPane1Layout.createSequentialGroup()
                        .addComponent(txt_visitante, javax.swing.GroupLayout.PREFERRED_SIZE, 222, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(81, 81, 81)
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cbx_tipo_reserva, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btn_modificarReserva, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jXTaskPane1Layout.setVerticalGroup(
            jXTaskPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXTaskPane1Layout.createSequentialGroup()
                .addGroup(jXTaskPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jXTaskPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txt_visitante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel1))
                    .addGroup(jXTaskPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel4)
                        .addComponent(cbx_tipo_reserva, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jXTaskPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(dp_hasta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2)
                    .addComponent(dp_desde, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3)
                    .addComponent(jLabel11)
                    .addComponent(txt_dni, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jXTaskPane1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(btn_modificarReserva, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        panelRect3.setBackground(new java.awt.Color(255, 255, 255));
        panelRect3.setForeground(new java.awt.Color(255, 255, 255));
        panelRect3.setColorPrimario(new java.awt.Color(255, 255, 255));
        panelRect3.setColorSecundario(new java.awt.Color(102, 102, 102));

        btn_Realizar_Reserva.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/Add.png"))); // NOI18N
        btn_Realizar_Reserva.setText("<html><p>  Nueva</p><p>Reserva</p></html>");
        btn_Realizar_Reserva.setHorizontalAlignment(javax.swing.SwingConstants.LEADING);
        btn_Realizar_Reserva.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btn_Realizar_Reserva.setToolTipText("Almacena una nueva Reserva del Salon");
        btn_Realizar_Reserva.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_Realizar_ReservaActionPerformed(evt);
            }
        });

        btn_Lista_Reservas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/Historial.png"))); // NOI18N
        btn_Lista_Reservas.setText("<html><p> Historial</p><p>Alquileres</p></html>");
        btn_Lista_Reservas.setHorizontalAlignment(javax.swing.SwingConstants.LEADING);
        btn_Lista_Reservas.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btn_Lista_Reservas.setToolTipText("Muestra un resumen de los Alquileres hechos en el pasado");
        btn_Lista_Reservas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_Lista_ReservasActionPerformed(evt);
            }
        });

        btn_Eliminar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/Close.png"))); // NOI18N
        btn_Eliminar.setText("<html><p>Eliminar</p><p>Reserva</p></html>");
        btn_Eliminar.setHorizontalAlignment(javax.swing.SwingConstants.LEADING);
        btn_Eliminar.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btn_Eliminar.setToolTipText("Elimina una Reserva Existente en el Sitema");
        btn_Eliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_EliminarActionPerformed(evt);
            }
        });

        btn_Alquilar_Salon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/Check.png"))); // NOI18N
        btn_Alquilar_Salon.setText("<html><p style=\"text-align:right\">    Alquilar</p><p style=\"text-align:right\">   Salon</p></html>");
        btn_Alquilar_Salon.setActionCommand("");
        btn_Alquilar_Salon.setHorizontalAlignment(javax.swing.SwingConstants.LEADING);
        btn_Alquilar_Salon.setToolTipText("Almacena un nuevo Alquiler del Salón");
        btn_Alquilar_Salon.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_Alquilar_SalonActionPerformed(evt);
            }
        });

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/Document.png"))); // NOI18N
        jButton1.setText("<html><p style=\"text-align:center\">Listar</p><p>Reservas</p></html>");
        jButton1.setActionCommand("<html><p style=\"text-align:right\">Listar</p><p>Reservas</p></html>");
        jButton1.setHorizontalAlignment(javax.swing.SwingConstants.LEADING);
        jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jButton1.setToolTipText("Muestra un resumen de las Reservas Activas");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        btn_checkOUT_Salon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/Alpha Dista Icon 17.png"))); // NOI18N
        btn_checkOUT_Salon.setText("<html><p style=\"text-align:right\">Check</p><p style=\"text-align:right\">OUT</p></html>");
        btn_checkOUT_Salon.setActionCommand("");
        btn_checkOUT_Salon.setHorizontalAlignment(javax.swing.SwingConstants.LEADING);
        btn_checkOUT_Salon.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btn_checkOUT_Salon.setToolTipText("Realiza el cierre del Alquiler Activo");
        btn_checkOUT_Salon.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_checkOUT_SalonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelRect3Layout = new javax.swing.GroupLayout(panelRect3);
        panelRect3.setLayout(panelRect3Layout);
        panelRect3Layout.setHorizontalGroup(
            panelRect3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelRect3Layout.createSequentialGroup()
                .addGap(17, 17, 17)
                .addGroup(panelRect3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(btn_Realizar_Reserva)
                    .addComponent(btn_Lista_Reservas)
                    .addComponent(btn_Alquilar_Salon)
                    .addComponent(btn_checkOUT_Salon)
                    .addComponent(btn_Eliminar)
                    .addComponent(jButton1))
                .addContainerGap(14, Short.MAX_VALUE))
        );
        panelRect3Layout.setVerticalGroup(
            panelRect3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelRect3Layout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addComponent(btn_Realizar_Reserva, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btn_Eliminar, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 222, Short.MAX_VALUE)
                .addComponent(btn_Alquilar_Salon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btn_checkOUT_Salon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btn_Lista_Reservas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(35, 35, 35))
        );

        jScrollPane2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jScrollPane2MouseClicked(evt);
            }
        });

        tbl_reservasSalon.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Tipo de Reserva", "Responsable de la Reserva", "Desde", "Hasta"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tbl_reservasSalon.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbl_reservasSalonMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(tbl_reservasSalon);

        jXTaskPane2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/Salon.png"))); // NOI18N
        jXTaskPane2.setTitle("Alquilar el Salon de Eventos");
        org.jdesktop.swingx.VerticalLayout verticalLayout1 = new org.jdesktop.swingx.VerticalLayout();
        verticalLayout1.setGap(2);
        jXTaskPane2.getContentPane().setLayout(verticalLayout1);

        jPanel3.setBorder(null);

        dp_diaOUT.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                dp_diaOUTActionPerformed(evt);
            }
        });

        jLabel5.setText("Fecha de Ingreso:");

        jLabel6.setText("Fecha de Egreso");

        txt_Precio_Unitario.addCaretListener(new javax.swing.event.CaretListener() {
            public void caretUpdate(javax.swing.event.CaretEvent evt) {
                txt_Precio_UnitarioCaretUpdate(evt);
            }
        });

        txt_Descuento.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txt_DescuentoKeyTyped(evt);
            }
        });

        jLabel7.setText("Precio Unitario:");

        jLabel8.setText("Descuento %:");

        jLabel9.setText("TOTAL:");

        jLabel10.setText("Tarifa");

        jLabel22.setText("A nombre de:");

        txt_representante.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                txt_representanteMouseClicked(evt);
            }
        });

        btn_capturar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/REAL OSX SYSTEM GRAB OLD.png"))); // NOI18N
        btn_capturar.setText("Campurar Reserva");
        btn_capturar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_capturarActionPerformed(evt);
            }
        });

        buttonCircle3.setText("buttonCircle3");
        buttonCircle3.setPreferredSize(new java.awt.Dimension(23, 23));
        buttonCircle3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonCircle3ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel22)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txt_representante, javax.swing.GroupLayout.PREFERRED_SIZE, 351, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(34, 34, 34))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                                .addComponent(jLabel5)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(dp_diaIN, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(jLabel7)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txt_Precio_Unitario)))
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel6))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                                .addGap(23, 23, 23)
                                .addComponent(jLabel8)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txt_Descuento)
                            .addComponent(dp_diaOUT, javax.swing.GroupLayout.DEFAULT_SIZE, 136, Short.MAX_VALUE))))
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 30, Short.MAX_VALUE)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 33, Short.MAX_VALUE)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txt_Total, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(cbx_tipo_alquiler, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(buttonCircle3, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap(19, Short.MAX_VALUE))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btn_capturar)
                        .addGap(18, 18, 18))))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel22)
                        .addComponent(txt_representante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(cbx_tipo_alquiler, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel10))
                    .addComponent(buttonCircle3, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txt_Precio_Unitario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7)
                    .addComponent(txt_Descuento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8)
                    .addComponent(txt_Total, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9))
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(dp_diaIN, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel6)
                            .addComponent(dp_diaOUT, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btn_capturar)
                        .addContainerGap())))
        );

        jXTaskPane2.getContentPane().add(jPanel3);

        jScrollPane3.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);

        tbl_alquileresSalon.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Tipo de Servicio", "Huesped", "Desde", "Hasta", "Descuento", "Total"
            }
        ));
        tbl_alquileresSalon.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbl_alquileresSalonMouseClicked(evt);
            }
        });
        jScrollPane3.setViewportView(tbl_alquileresSalon);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTextField1)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addComponent(jXTaskPane1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addComponent(jScrollPane3)
                    .addComponent(jXTaskPane2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(panelRect3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 89, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jXTaskPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jXTaskPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(panelRect3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );

        add(jPanel1);
    }// </editor-fold>//GEN-END:initComponents

    private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextField1ActionPerformed
    
    private void btn_Realizar_ReservaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_Realizar_ReservaActionPerformed
        Visitante elVisitante = huesped_resrva;
        Date desde = dp_desde.getDate();
        Date hasta = dp_hasta.getDate();
        int noches = GUIM.diferenciasDeFechas(desde, hasta);
        String unDni = txt_dni.getText();
        Salon elSalon = unaHosteria.getSalon();
        Tarifa_Salon tipoServicio = (Tarifa_Salon) cbx_tipo_reserva.getSelectedItem();
        try {
            unaHosteria.reservar_Salon(elVisitante, desde, hasta, noches, unDni, tipoServicio, elSalon);
            iniciarInterface();
            this.updateUI();
            
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(this, ex);
        }
        
        
        
    }//GEN-LAST:event_btn_Realizar_ReservaActionPerformed
    
    private void btn_Lista_ReservasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_Lista_ReservasActionPerformed
        JDialog frame;
        if (SwingUtilities.getWindowAncestor(this) instanceof JDialog) {
            frame = new JDialog((JDialog) SwingUtilities.getWindowAncestor(this), true);
        } else {
            frame = new JDialog((JFrame) SwingUtilities.getWindowAncestor(this), true);
        }
        Historial_Salon unaLista = new Historial_Salon(unaHosteria);
        
        frame.getContentPane().removeAll();
        frame.getContentPane().add(unaLista);
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.show();
        
    }//GEN-LAST:event_btn_Lista_ReservasActionPerformed
    
    private void btn_EliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_EliminarActionPerformed
        
        int res = JOptionPane.showConfirmDialog(this, "¿Esta seguro de eliminar la Reserva seleccionada?",
                "Advertencia", JOptionPane.YES_NO_OPTION);
        if (res == JOptionPane.YES_OPTION) {
            Reserva_Salon unaReserva = (Reserva_Salon) tbl_reservasSalon.getValueAt(tbl_reservasSalon.getSelectedRow(), 0);
            unaHosteria.eliminar_reservaSalon(unaReserva);
            iniciarInterface();
        }
    }//GEN-LAST:event_btn_EliminarActionPerformed
    
    private void txt_Precio_UnitarioCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_txt_Precio_UnitarioCaretUpdate
//        calcularDescuento();
    }//GEN-LAST:event_txt_Precio_UnitarioCaretUpdate
    
    private void btn_Alquilar_SalonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_Alquilar_SalonActionPerformed
        
        Calendar hoy = Calendar.getInstance();
        Calendar fechaIngresada = Calendar.getInstance();
        fechaIngresada.setTime(dp_diaIN.getDate());
        
        if (hoy.get(Calendar.DAY_OF_YEAR) != fechaIngresada.get(Calendar.DAY_OF_YEAR)) {
            JOptionPane.showMessageDialog(this, "Usted no puede alquilar el Salon para una fecha que no sea el dia de hoy");
        } else {
            
            
            Calendar diaReserva = Calendar.getInstance();
            if (seleccionada == null) {
                JOptionPane.showMessageDialog(this, "Usted debe seleccionar la reserva correpondiente");
                btn_capturarActionPerformed(evt);
                
            } else {
                
                double descuento = 0.00;
                Date diaIn = dp_diaIN.getDate();
                Date diaOut = dp_diaOUT.getDate();
                int dias = GUIM.diferenciasDeFechas(diaIn, diaOut);
                Tarifa_Salon unaTarifa_Salon = (Tarifa_Salon) cbx_tipo_alquiler.getSelectedItem();
                if (!txt_Descuento.getText().isEmpty()) {
                    descuento = Double.valueOf(txt_Descuento.getText());
                }
                
                if (huesped_alquiler != null) {
                    unaHosteria.eliminar_reservaSalon(seleccionada);
                    try {
                        Hospedaje_Salon alquilar_Salon = unaHosteria.checkIN_Salon(huesped_alquiler, diaOut, diaOut, unaHosteria.getSalon(), unaTarifa_Salon, descuento);
                    } catch (Exception ex) {
                        Logger.getLogger(Salon_de_Eventos.class.getName()).log(Level.SEVERE, null, ex);
                    }
                    iniciarInterface();
                } else {
                    JOptionPane.showMessageDialog(this, "Debe seleccionar un Visitante para realizar la operacion");
                }
            }
        }
    }//GEN-LAST:event_btn_Alquilar_SalonActionPerformed
    
    private void jScrollPane2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jScrollPane2MouseClicked
    }//GEN-LAST:event_jScrollPane2MouseClicked
    
    private void btn_modificarReservaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_modificarReservaActionPerformed
        
        Visitante elVisitante = huesped_resrva;
        Date desde = dp_desde.getDate();
        Date hasta = dp_hasta.getDate();
        int noches = GUIM.diferenciasDeFechas(desde, hasta);
        Salon elSalon = unaHosteria.getSalon();
        Tarifa_Salon tipoServicio = (Tarifa_Salon) cbx_tipo_reserva.getSelectedItem();
        Reserva_Salon unaReserva_Salon = (Reserva_Salon) tbl_reservasSalon.getValueAt(tbl_reservasSalon.getSelectedRow(), 0);
        
        try {
            unaHosteria.modificar_ReservaSalon(unaReserva_Salon, elVisitante, desde, hasta, noches, elSalon, tipoServicio);
            GUIM.cargarReservasSalon(tbl_reservasSalon, unaHosteria.getReservas_Salon());
            cargarGrilla(tbl_reservasSalon);
            btn_modificarReserva.setEnabled(false);
            this.updateUI();
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(this, ex);
        }
    }//GEN-LAST:event_btn_modificarReservaActionPerformed
    
    private void tbl_reservasSalonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbl_reservasSalonMouseClicked
        if (tbl_reservasSalon.getSelectedRowCount() != 0) {
            btn_modificarReserva.setEnabled(true);
            Reserva_Salon unaReserva_Salon = (Reserva_Salon) tbl_reservasSalon.getValueAt(tbl_reservasSalon.getSelectedRow(), 0);
            txt_visitante.setText(unaReserva_Salon.getUnVisitante().getApellido());
            dp_desde.setDate(unaReserva_Salon.getDesdeFecha());
            dp_hasta.setDate(unaReserva_Salon.getHastaFecha());
            cbx_tipo_reserva.setSelectedItem(unaReserva_Salon.getTipo());
            txt_dni.setText(unaReserva_Salon.getDni());
        }
    }//GEN-LAST:event_tbl_reservasSalonMouseClicked
    
    private void btn_capturarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_capturarActionPerformed
        Calendar hoy = Calendar.getInstance();
        Calendar diaReserva = Calendar.getInstance();
        
        List<Reserva_Salon> Lista_del_dia = new LinkedList<>();
        for (Reserva_Salon unaReserva_Salon : unaHosteria.getReservas_Salon()) {
            diaReserva.setTime(unaReserva_Salon.getDesdeFecha());
            if (diaReserva.get(Calendar.DAY_OF_YEAR) == hoy.get(Calendar.DAY_OF_YEAR)) {
                Lista_del_dia.add(unaReserva_Salon);
            }
            
        }
        
        if (!Lista_del_dia.isEmpty()) {
            JDialog frame;
            if (SwingUtilities.getWindowAncestor(this) instanceof JDialog) {
                frame = new JDialog((JDialog) SwingUtilities.getWindowAncestor(this), true);
            } else {
                frame = new JDialog((JFrame) SwingUtilities.getWindowAncestor(this), true);
            }
            Capturar_RS unaLista = new Capturar_RS(unaHosteria.getReservas_Salon());
            frame.getContentPane().removeAll();
            frame.getContentPane().add(unaLista);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.show();
            
            if (unaLista.getUnaReserva_Salon() != null) {
                seleccionada = unaLista.getUnaReserva_Salon();
                huesped_alquiler = seleccionada.getUnVisitante();
                txt_representante.setText(huesped_alquiler.getApellido() + " " + huesped_alquiler.getNombre());
                dp_diaIN.setDate(seleccionada.getDesdeFecha());
                dp_diaOUT.setDate(seleccionada.getHastaFecha());
                cbx_tipo_alquiler.setSelectedItem(seleccionada.getTipo());
                txt_Precio_Unitario.setText(String.valueOf(seleccionada.getTipo().getPrecio()));
                txt_Total.setText(String.valueOf(seleccionada.getTipo().getPrecio() * seleccionada.getCantidad_de_Noches()));
            }
        } else {
            JOptionPane.showMessageDialog(this, "No existen reservas para el dia de la fecha");
        }
        
        
        
    }//GEN-LAST:event_btn_capturarActionPerformed
    
    private void btn_checkOUT_SalonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_checkOUT_SalonActionPerformed
        
        if (tbl_alquileresSalon.getSelectedRowCount() != 0) {
            if (verificar_Caja()) {
                Hospedaje_Salon unHospedaje_Salon = (Hospedaje_Salon) tbl_alquileresSalon.getValueAt(tbl_alquileresSalon.getSelectedRow(), 0);
                if (unHospedaje_Salon != null) {
                    JDialog frame;
                    if (SwingUtilities.getWindowAncestor(this) instanceof JDialog) {
                        frame = new JDialog((JDialog) SwingUtilities.getWindowAncestor(this), true);
                    } else {
                        frame = new JDialog((JFrame) SwingUtilities.getWindowAncestor(this), true);
                    }
                    CheckOUT_Salon out = new CheckOUT_Salon(unaHosteria, unHospedaje_Salon);
                    frame.getContentPane().removeAll();
                    frame.getContentPane().add(out);
                    frame.pack();
                    frame.setLocationRelativeTo(null);
                    frame.show();
                }
            }
        } else {
            JOptionPane.showMessageDialog(this, "Debe seleccionar un alquiler de la tabla de Alquileres para continuar la operacion");
        }
    }//GEN-LAST:event_btn_checkOUT_SalonActionPerformed
    
    private void tbl_alquileresSalonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbl_alquileresSalonMouseClicked
        elHospedaje_Salon = (Hospedaje_Salon) tbl_alquileresSalon.getValueAt(tbl_alquileresSalon.getSelectedRow(), 0);
        if (elHospedaje_Salon != null) {
            txt_representante.setText(elHospedaje_Salon.getUnVisitante().getApellido() + " " + elHospedaje_Salon.getUnVisitante().getNombre());
            dp_diaIN.setDate(elHospedaje_Salon.getIngreso());
            dp_diaOUT.setDate(elHospedaje_Salon.getEgreso());
            cbx_tipo_alquiler.setSelectedItem(elHospedaje_Salon.getServicio());
            txt_Precio_Unitario.setText(String.valueOf(elHospedaje_Salon.getServicio().getPrecio()));
            txt_Total.setText(String.valueOf(elHospedaje_Salon.getServicio().getPrecio() * elHospedaje_Salon.getCantidad_dias()));
        }
    }//GEN-LAST:event_tbl_alquileresSalonMouseClicked
    
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        try {
            List<Reserva_Salon> historial = unaHosteria.getReservas_Salon();
            HashMap<String, Object> parametros = new HashMap();
            parametros.clear();
            
            JasperReport jasper = JasperCompileManager.compileReport("src/Reportes/Reservas_Salon.jrxml");
            JasperPrint jasperPrint = JasperFillManager.fillReport(jasper, parametros, new JRBeanCollectionDataSource(historial));
            JasperViewer jviewer = new JasperViewer(jasperPrint, false);
            jviewer.show();
        } catch (JRException ex) {
            JOptionPane.showMessageDialog(this, ex.getMessage());
        }
    }//GEN-LAST:event_jButton1ActionPerformed
    
    private void txt_dniKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_dniKeyTyped
        if (!GUIM.esEntero(evt.getKeyChar())) {
            evt.consume();
        }
    }//GEN-LAST:event_txt_dniKeyTyped
    
    private void txt_visitanteKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_visitanteKeyTyped
        if (!GUIM.esLetra(evt.getKeyChar())) {
            evt.consume();
        }
    }//GEN-LAST:event_txt_visitanteKeyTyped
    
    private void txt_DescuentoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_DescuentoKeyTyped
        if (!GUIM.esEntero(evt.getKeyChar())) {
            evt.consume();
        }
    }//GEN-LAST:event_txt_DescuentoKeyTyped
    
    private void dp_hastaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dp_hastaActionPerformed
        if (dp_hasta.getDate().before(dp_desde.getDate()) || dp_hasta.getDate().equals(dp_desde.getDate())) {
            JOptionPane.showMessageDialog(this, "La Fecha de Salida no puede ser anterior o igual a la Fecha de Entrada");
            Calendar calendario = Calendar.getInstance();
            calendario.setTime(dp_desde.getDate());
            calendario.add(Calendar.DAY_OF_MONTH, 1);
            dp_hasta.setDate(calendario.getTime());
        }
    }//GEN-LAST:event_dp_hastaActionPerformed
    
    private void dp_diaOUTActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dp_diaOUTActionPerformed
        if (dp_diaOUT.getDate().before(dp_diaIN.getDate()) || dp_diaOUT.getDate().equals(dp_diaIN.getDate())) {
            JOptionPane.showMessageDialog(this, "La Fecha de Salida no puede ser anterior o igual a la Fecha de Entrada");
            Calendar calendario = Calendar.getInstance();
            calendario.setTime(dp_diaIN.getDate());
            calendario.add(Calendar.DAY_OF_MONTH, 1);
            dp_diaOUT.setDate(calendario.getTime());
        }
    }//GEN-LAST:event_dp_diaOUTActionPerformed
    
    private void txt_visitanteMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txt_visitanteMouseClicked
        Visitante unVisitante = abrir_panel_captura_visitante();
        if (unVisitante != null) {
            txt_visitante.setText(unVisitante.getApellido() + " " + unVisitante.getNombre());
            huesped_resrva = unVisitante;
            txt_dni.setText(unVisitante.getDni());
            txt_dni.setFocusable(false);
        }
    }//GEN-LAST:event_txt_visitanteMouseClicked
    
    private void txt_representanteMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txt_representanteMouseClicked
        
        Visitante unVisitante = abrir_panel_captura_visitante();
        if (unVisitante != null) {
            txt_representante.setText(unVisitante.getApellido() + " " + unVisitante.getNombre());
            huesped_alquiler = unVisitante;
        }
        
    }//GEN-LAST:event_txt_representanteMouseClicked
    
    private void buttonCircle3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCircle3ActionPerformed
        JDialog frame;
        if (SwingUtilities.getWindowAncestor(this) instanceof JDialog) {
            frame = new JDialog((JDialog) SwingUtilities.getWindowAncestor(this), true);
        } else {
            frame = new JDialog((JFrame) SwingUtilities.getWindowAncestor(this), true);
        }
        Parametros_Salon unPar = new Parametros_Salon(unaHosteria);
        frame.getContentPane().removeAll();
        frame.getContentPane().add(unPar);
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.show();
    }//GEN-LAST:event_buttonCircle3ActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btn_Alquilar_Salon;
    private javax.swing.JButton btn_Eliminar;
    private javax.swing.JButton btn_Lista_Reservas;
    private javax.swing.JButton btn_Realizar_Reserva;
    private javax.swing.JButton btn_capturar;
    private javax.swing.JButton btn_checkOUT_Salon;
    private javax.swing.JButton btn_modificarReserva;
    private org.edisoncor.gui.button.ButtonCircle buttonCircle1;
    private org.edisoncor.gui.button.ButtonCircle buttonCircle2;
    private org.edisoncor.gui.button.ButtonCircle buttonCircle3;
    private javax.swing.JComboBox cbx_tipo_alquiler;
    private javax.swing.JComboBox cbx_tipo_reserva;
    private org.jdesktop.swingx.JXDatePicker dp_desde;
    private org.jdesktop.swingx.JXDatePicker dp_diaIN;
    private org.jdesktop.swingx.JXDatePicker dp_diaOUT;
    private org.jdesktop.swingx.JXDatePicker dp_hasta;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTextField jTextField1;
    private org.jdesktop.swingx.JXTaskPane jXTaskPane1;
    private org.jdesktop.swingx.JXTaskPane jXTaskPane2;
    private org.edisoncor.gui.panel.PanelRect panelRect3;
    private javax.swing.JPanel pnl_tbl_reservas;
    private javax.swing.JTable tbl_alquileresSalon;
    private javax.swing.JTable tbl_reservasSalon;
    private javax.swing.JTextField txt_Descuento;
    private javax.swing.JTextField txt_Precio_Unitario;
    private javax.swing.JTextField txt_Total;
    private javax.swing.JTextField txt_dni;
    private javax.swing.JTextField txt_representante;
    private javax.swing.JTextField txt_visitante;
    // End of variables declaration//GEN-END:variables

    private void iniciarInterface() {
        pnl_tbl_reservas.removeAll();
        txt_dni.setFocusable(true);
        JTable unaTabla = GUIM.crear_tabla_Salon();
        btn_modificarReserva.setEnabled(false);
        pnl_tbl_reservas.add(unaTabla);
        
        for (Tarifa_Salon unaTarifa_Salon : unaHosteria.getTarifas_Salon()) {
            cbx_tipo_alquiler.addItem(unaTarifa_Salon);
            cbx_tipo_reserva.addItem(unaTarifa_Salon);
        }
        
        cbx_tipo_alquiler.setSelectedIndex(0);
        cbx_tipo_reserva.setSelectedIndex(0);
        txt_Precio_Unitario.setText(String.valueOf(((Tarifa_Salon) cbx_tipo_alquiler.getSelectedItem()).getPrecio()));
        
        Calendar calendario = Calendar.getInstance();
        dp_desde.setDate(calendario.getTime());
        dp_diaIN.setDate(calendario.getTime());
        calendario.add(Calendar.DAY_OF_MONTH, 1);
        dp_hasta.setDate(calendario.getTime());
        dp_diaOUT.setDate(calendario.getTime());
        
        List<Hospedaje_Salon> activos = new LinkedList<>();
        for (Hospedaje_Salon unHospedaje_Salon : unaHosteria.getAlquileresSalon()) {
            if (!unHospedaje_Salon.isCheck_out()) {
                activos.add(unHospedaje_Salon);
            }
        }
        
        GUIM.cargarReservasSalon(tbl_reservasSalon, unaHosteria.getReservas_Salon());
        GUIM.cargarTablaAlquileres(tbl_alquileresSalon, activos);
        cargarGrilla(unaTabla);
        this.updateUI();
        
    }
    
    public static void cargarGrilla(JTable unaTabla) {
        
        if (!unaHosteria.getAlquileresSalon().isEmpty()) {
            for (Hospedaje_Salon unHospedaje_Salon : unaHosteria.getAlquileresSalon()) {
                if (!unHospedaje_Salon.isCheck_out()) {
                    
                    int cant = unHospedaje_Salon.getCantidad_dias();
                    
                    Calendar salio = Calendar.getInstance();
                    salio.setTime(unHospedaje_Salon.getEgreso());
                    int dia_salida = salio.get(Calendar.DAY_OF_MONTH);
                    int mes_salida = salio.get(Calendar.MONTH);
                    
                    DefaultTableModel modelo = (DefaultTableModel) unaTabla.getModel();
                    
                    for (int j = modelo.getColumnCount() - 1; j > 1; j--) {
                        if (modelo.getValueAt(0, j).equals((dia_salida - 1) + "/" + (mes_salida + 1))) {
                            for (int c = j; c > (j - cant); c--) {
                                
                                if (c >= 1) {
                                    unaTabla.setValueAt(unHospedaje_Salon, 1, c);
                                    TableColumn tcol = unaTabla.getColumnModel().getColumn(c);
                                    tcol.setCellRenderer(new Pintar_Celdas());
                                }
                            }
                        }
                    }
                }
            }
        }
        
        if (!unaHosteria.getReservas_Salon().isEmpty()) {
            for (Reserva_Salon unaReserva : unaHosteria.getReservas_Salon()) {
                int cant = unaReserva.getCantidad_de_Noches();
                
                Calendar salio = Calendar.getInstance();
                salio.setTime(unaReserva.getHastaFecha());
                int dia_salida = salio.get(Calendar.DAY_OF_MONTH);
                int mes_salida = salio.get(Calendar.MONTH);
                
                DefaultTableModel modelo = (DefaultTableModel) unaTabla.getModel();
                
                for (int j = modelo.getColumnCount() - 1; j > 1; j--) {
                    if (modelo.getValueAt(0, j).equals((dia_salida - 1) + "/" + (mes_salida + 1))) {
                        for (int c = j; c > (j - cant); c--) {
                            
                            if (c >= 1) {
                                unaTabla.setValueAt(unaReserva, 1, c);
                                TableColumn tcol = unaTabla.getColumnModel().getColumn(c);
                                tcol.setCellRenderer(new Pintar_Celdas());
                            }
                        }
                    }
                }
            }
        }
        
    }
    
    private Visitante abrir_panel_captura_visitante() {
        JDialog frame;
        if (SwingUtilities.getWindowAncestor(this) instanceof JDialog) {
            frame = new JDialog((JDialog) SwingUtilities.getWindowAncestor(this), true);
        } else {
            frame = new JDialog((JFrame) SwingUtilities.getWindowAncestor(this), true);
        }
        Vista_Visitante panel_captura_visitante = new Vista_Visitante(unaHosteria, null);
        frame.getContentPane().removeAll();
        frame.getContentPane().add(panel_captura_visitante);
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.show();
        if (panel_captura_visitante.getSelected_Visitante().getSelectedRowCount() != 0) {
            return (Visitante) panel_captura_visitante.getSelected_Visitante().getValueAt(panel_captura_visitante.getSelected_Visitante().getSelectedRow(), 0);
        } else {
            return null;
        }
    }
    
    private boolean verificar_Caja() {
        boolean ok = false;
        Caja unaCaja = unaHosteria.getCajaPrincipal();
        Vista_Caja unavista = new Vista_Caja(unaHosteria, unaCaja);
        
        if (unavista.loteVigente() != null) {
            if (unavista.loteVigente().isCerrado()) {
                int res = JOptionPane.showConfirmDialog(this, "Debe existir un Lote que no se haya cerrado al que pueda asignar el Check-OUT, debe inicializar un nuevo Lote para continuar la operacion",
                        "Advertencia", JOptionPane.YES_OPTION);
                if (res == JOptionPane.YES_OPTION) {
                    JDialog jf = new JDialog((JFrame) SwingUtilities.getWindowAncestor(this), true);
                    Apertura_Caja apertura = new Apertura_Caja(unaCaja);
                    jf.getContentPane().removeAll();
                    jf.getContentPane().add(apertura);
                    jf.pack();
                    jf.setLocationRelativeTo(null);
                    jf.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                    jf.show();
                    ok = true;
                    
                }
            } else {
                ok = true;
            }
        } else {
            int res = JOptionPane.showConfirmDialog(this, "Aun no existe ningun Lote al que pueda asignar el Check-OUT, debe inicializar un Lote para continuar la operacion",
                    "Advertencia", JOptionPane.YES_OPTION);
            if (res == JOptionPane.YES_OPTION) {
                JDialog jf = new JDialog((JFrame) SwingUtilities.getWindowAncestor(this), true);
                
                Apertura_Caja apertura = new Apertura_Caja(unaCaja);
                jf.getContentPane().removeAll();
                jf.getContentPane().add(apertura);
                jf.pack();
                jf.setLocationRelativeTo(null);
                jf.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                jf.show();
                ok = true;
                
            }
        }
        return ok;
        
    }
}
